# -*- coding: utf8 -*-
import pygame

def loadResources():
	global images
	global fonts
	global audios
	global musics
	images = {
		"title": pygame.image.load('images/title.png'),
		"background": pygame.image.load('images/background.png'),
		"shot1": pygame.image.load('images/shot1.png'),
		"shot2": pygame.image.load('images/shot2.png'),
		"ship": pygame.image.load('images/ship.png'),
		"enemy1": pygame.image.load('images/enemy1.png'),
		"enemy2": pygame.image.load('images/enemy2.png'),
		"enemy3": pygame.image.load('images/enemy3.png'),
		"explosion": loadExplosion()
	}
	fonts = {
		"default": pygame.font.Font('fonts/default.ttf', 12)
	}
	musics = {
		"default": 'musics/Dant3   Dant3 Is My Real Name (EDM).mp3'
	}
	audios = {
		"shoot": pygame.mixer.Sound('audios/shot.wav'),
		"explosion": pygame.mixer.Sound('audios/explosion.wav'),
		"gameover": pygame.mixer.Sound('audios/gameover.wav'),
	}

def loadExplosion():
	image = pygame.image.load('images/explosion.png')
	width = 64
	height = 64
	amountH = 4
	amountV = 4
	frames = list()
	for j in xrange(amountV):
		for i in xrange(amountH):
			rect = pygame.rect.Rect(width * i, height * j, width, height)
			frame = image.subsurface(rect)
			frames.append(frame)
	return frames
